#define _CRT_SECURE_NO_WARNINGS 1 

#include<iostream>
#include<vector>
using namespace std;

class Solution
{
public:
    int findPeakElement(vector<int>& nums)
    {
        int left = 0, right = nums.size() - 1;
        while (left < right)
        {
            int mid = left + (right - left) / 2;
            if (nums[mid] > nums[mid + 1]) right = mid;
            else left = mid + 1;
        }
        return left;
    }
};

int main()
{
    vector<int> nums;
    Solution sol;
    nums.push_back(1);
    nums.push_back(2);
    nums.push_back(1);
    nums.push_back(3);
    nums.push_back(5);
    nums.push_back(6);
    nums.push_back(4);

    int ret = sol.findPeakElement(nums);
    cout << ret << endl;
    return 0;
}